package com.dandelion.manager.system.web.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.ResponseBody;

import com.dandelion.commons.annotation.SystemLog;
import com.dandelion.commons.constants.BaseConst;
import com.dandelion.commons.web.controller.BaseController;
import com.dandelion.commons.web.model.AjaxResponse;
import com.dandelion.commons.web.model.DataGrid;
import com.dandelion.manager.system.domain.SysLogLogin;
import com.dandelion.manager.system.service.SysLogLoginService;

@Controller
@RequestMapping("/manager/system/syslog_login")
public class SysLogLoginController extends BaseController {

	@Autowired
	public SysLogLoginService service ;
	
	/**
	 * 登录日志主页
	 * @return
	 */
	@RequestMapping(value="/main_login", method=RequestMethod.GET)
	public String main_login(Model model) {
		return "/manager/system/syslog/main_login" ;
	}
	
	/**
	 * 删除
	 * @param ids 数组
	 * @return
	 */
	@SystemLog(module=BaseConst.MODULE_SYSTEM+"[日志管理]", method="删除登录日志")
	@RequestMapping(value="/delete", method=RequestMethod.POST)
	public @ResponseBody AjaxResponse delete(Long[] ids) {
		return this.service.deleteBatch(ids);
	}
	
	/**
	 * 根据ID获取数据
	 * @param id
	 * @return
	 */
	@RequestMapping(value="/get/{id}", method=RequestMethod.GET)
	public @ResponseBody SysLogLogin get(@PathVariable Long id) {
		return this.service.get(id) ;
	}
	
	/**
	 * 登录日志数据列表-分页查询
	 * @param dto
	 * @return
	 */
	@RequestMapping(value="/datagrid")
	public @ResponseBody DataGrid<SysLogLogin> datagrid(SysLogLogin dto) {
		return this.service.datagrid(dto) ;
	}
	
}
